#include <iostream>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

int main()
{
    int x;
    cin >> x;
    string str ="1";
    int num = stoi(str);
    while(num % x != 0)
    {
        str += "1";
        num = stoi(str);
    }
    /*if (str.size())
        str.pop_back();
    num = stoi(str);
    cout << num / x << ' ' << str.size();*/
    return 0;
}